package org.ic992929.SbStart.service;
  
import javax.annotation.Resource;

import org.ic992929.SbStart.bean.Demo;
import org.ic992929.SbStart.dao.DemoDao;
import org.ic992929.SbStart.dao.DemoRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 提供Demo服务类.
 * @author Administrator
 *
 */
@Service
public class DemoService {
    
    @Resource
    private DemoRepository demoRepository;

    @Resource
    private DemoDao demoDao;


    public Demo getById(long id){
        //demoRepository.findOne(id);//在demoRepository可以直接使用findOne进行获取.
        return demoDao.getById(id);
    }
    
    @Transactional
    public void save(Demo demo){
       demoRepository.save(demo);
    }
}